/*
 * @Author: 李苏皖 onceseo@163.com
 * @Date: 2025-08-04 23:16:22
 * @LastEditors: 李苏皖 onceseo@163.com
 * @LastEditTime: 2025-08-10 18:30:44
 * @FilePath: \zygj-pc\src\mixin\stockList.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
export default {
  data() {
    return {
      params: {
        commonSearch: '',
        total: 0,
        isZero: '2',
        pageSize: 10,
        pageNum: 1
      }
    };
  },
  methods: {
    //获取表格数据
    async getDataList() {
      let res = await this.$api.get(this.$url.inventoryAll, this.params);
      res.rows.forEach(val => {
        val.selected = false;
      });
      this.tableData = res.rows;
      this.params.total = res.total;
    },
    //修改页码
    changePage(pageNum) {
      this.params.pageNum = pageNum;
      this.getDataList();
    },
    //修改每页显示的条数
    changeSize(size) {
      this.params.pageSize = size;
      this.params.pageNum = 1;
      this.getDataList();
    },
    //搜索品牌
    handleSearch() {
      this.params.pageNum = 1;
      this.params.pageSize = 10;
      this.getDataList();
    },
    selectedProduct(row) {
      row.selected = !row.selected;
    }
  }
};
